<?php

/**
 * 产品表
 */
class product_img_info extends CActiveRecord
{
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'product_img_info';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('product_id,url', 'safe'),
		);
	}

	public function getProductImg($id){
		if(!$id>0){ return false;}
		$sql='SELECT `url` FROM `product_img_info` WHERE `product_id`='.$id;
		$model=Yii::app()->db->createCommand($sql)->queryAll();
		return $model[0]['url'];
	}




}
